package com.wisely.ch8_4.controller;

import com.wisely.ch8_4.domain.Person;
import com.wisely.ch8_4.service.IPersonService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class PersonController {
    @Autowired
    private IPersonService personService;

    @RequestMapping(value = "/rollback")
    public Person rollback(Person person) {
        return personService.savePersonWithRollback(person);
    }

    @RequestMapping(value = "/noRollback")
    public Person noRollback(Person person) {
        return personService.savePersonWithoutRollback(person);
    }
}
